var sysMessageField = dataObject.sysMessageField;
var msgJson;

var vm = new Vue({
	el:'#app',
});

$(function () {
	$.ajax({
		type: "POST",
	    url: $path + "/sys/sysMessage/messageList",
	    data: "",
	    success: function(r){
	    	initList(r);
	    }
	});
	console.log(i18nLanguage);
});

function initList(r){
	msgJson=r.msgList;
	msgJson = eval('(' + msgJson + ')');
	console.log(msgJson);
	var tabNode = document.getElementById('table1'); //取得自定义的表对象
	var thNode = tabNode.createTHead();
	var trNode=thNode.insertRow();	 
	var obj1 = document.createElement("TH");
	var obj2 = document.createElement("TH");
	var obj3 = document.createElement("TH");
	obj1.style.cssText="text-align: center;";
	obj2.style.cssText="text-align: center;";
	obj3.style.cssText="text-align: center;";


	obj1.innerHTML=" <div class='th-inner sortable both'>"+sysMessageField.model+"</div>";
		obj2.innerHTML=" <div class='th-inner sortable both'>"+sysMessageField.waitSubmit+"</div>";
			obj3.innerHTML=" <div class='th-inner sortable both'>"+sysMessageField.waitPass+"</div>";

	trNode.appendChild(obj1);
	trNode.appendChild(obj2);
	trNode.appendChild(obj3);
	var tbNode = document.createElement("tbody");
	tabNode.appendChild(tbNode);
	for (var i = 0; i < msgJson.length; i++) {
		var td1=document.createElement("td");
		var td2=document.createElement("td");
		var td3=document.createElement("td");
		td1.style.cssText="white-space: nowrap; text-align: center; ";
		td2.style.cssText="white-space: nowrap; text-align: center; ";
		td3.style.cssText="white-space: nowrap; text-align: center; ";

		var mk = msgJson[i].moduleName;
		var waitSubmit = msgJson[i].waitSubmit;
		var waitPass = msgJson[i].waitPass;
		for(var k in msgJson[i].map){
			console.log(msgJson[i].map[k]);
		}
		var hrefSubmit="";
		var hrefPass = "";
		
		var trNode1=tabNode.insertRow();
		if(msgJson[i].moduleId==1){
			mk=sysMessageField.redpacket;
			hrefSubmit = "../bus/busredpacket.html?status=0";
			hrefPass = "../bus/busredpacket.html?status=1";
		}else if(msgJson[i].moduleId==2){
			mk=sysMessageField.wxCardMp;
			/*hrefSubmit = "../bus/buswxcardmp.html?status=0";
			hrefPass = "../bus/buswxcardmp.html?status=1";*/
			hrefSubmit = "../bus/buswxcardmp.html?status=0";
			hrefPass = "../bus/buswxcardmp.html?status=1";
		}else if(msgJson[i].moduleId==3){
			mk=sysMessageField.activity;
			hrefSubmit = "../bus/busactivity.html?status=0";
			hrefPass = "../bus/busactivity.html?status=1";
		}else if(msgJson[i].moduleId==4){
			mk=sysMessageField.material;
			hrefSubmit = "../adv/advmaterial.html?status=0";
			hrefPass = "../adv/advmaterial.html?status=1";
		}else if(msgJson[i].moduleId==5){
			mk=sysMessageField.advTemplate;
			hrefSubmit = "../adv/advtemplate.html?status=0";
			hrefPass = "../adv/advtemplate.html?status=1";
		}
        else if(msgJson[i].moduleId==6){
            mk=sysMessageField.advRpPortal;
            hrefSubmit = "../adv/advrpportal.html?status=0";
            hrefPass = "../adv/advrpportal.html?status=1";
        }
        else if(msgJson[i].moduleId==7){
            mk=sysMessageField.schMgmt;
            hrefSubmit = "../adv/advschedule.html?status=0";
            hrefPass = "../adv/advschedule.html?status=1";
        }
        else if(msgJson[i].moduleId==8){
            mk=sysMessageField.advDispatchStrategy;
            hrefSubmit = "../adv/advdispatchstrategy.html?status=0";
            hrefPass = "../adv/advdispatchstrategy.html?status=1";
        }
		td1.innerHTML = "<span style='white-space:nowrap'>"+mk+"</span>";
		td2.innerHTML = "<span style='white-space:nowrap'><a href='"+hrefSubmit+"'>"+waitSubmit+"</a></span>";
		td3.innerHTML = "<span style='white-space:nowrap'><a href='"+hrefPass+"'>"+waitPass+"</a></span>";
		trNode1.appendChild(td1);
		trNode1.appendChild(td2);
		trNode1.appendChild(td3);
		tbNode.appendChild(trNode1);

		
	}
}





